<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./OL_SDK/include-openlayers-local.js"></script>
    <script src="./libs/gaode.js"></script>
    <script src="./utils/Point.js"></script>
</head>

<body>
    <button onclick="addPoint()">测试封装点</button>
    <div id="map">
    </div>
    <script>
        var docLayer = new Zondy.Map.Doc("", "myTestMap", {

        })
        var map = new ol.Map({
            target: "map",
            layers: [gaode, docLayer],
            view: new ol.View({
                projection: 'EPSG:4326',
                center: [114.30, 30.50],
                zoom: 4
            })
        })
        function addPoint() {
            var position = [80, -2];
            var attr = [ // 字段的 属性名 属性值 类型
                { name: "skill", value: "webgis", type: "string" },
                // { name: "skill", value: "webgis02", type: "string" },
                // 属性字段重复了，也不行。也不执行完成的回调。
                { name: "can", value: true, type: "boolean" },
                { name: "love", value: "zsw", type: "string" },
                { name: "hobby", value: "jiahe", type: "string" },
            ]
            var service = {
                name: "myTestMap",
                layerId: 4
            }
            Point.add({
                position,
                attr,
                service,
                docLayer
            })
        }
        /* 在地图使用点击事件,mapgis数据库添加要素 */

    </script>
</body>

</html>